1. /* snmvaloc.cpp by K.Tsuru */
  2. // function ID = 101
  3. /***********************************
  4. SNumber class
  5. It allocates the memory of figure[].
  6. See "snum.h" for details.
  7. ************************************/
  8. #ifndef SN_H
  9. #include "sn.h"
  10. #endif
  11. uint SNumber::valloc(uint sz, int copy){
  12. sz = max(sz, minArraySize); //It does not free the memory.
  13. uint max_sz = SNMaxSize(type);
  14. uint alcsz = (CutDown() == DISABLE) ? max(sz, figure.size()) : sz;
  15. if(alcsz > max_sz){
  16. if(type & REAL) alcsz = max_sz; //real number type(SDouble or SDecimal)
  17. else if(alcsz > MaxArraySize()) SetError(OVERFLOW_ERR, "valloc", 101);//integer
  18. }
  19. #ifndef NDEBUG
  20. int err = figure.Error();
  21. sz = figure.size(alcsz, copy); //change size
  22. assert(sz >= minArraySize);
  23. assert(sz <= MaxArraySize());
  24. err |= figure.Error();
  25. if(err != figure.NORMAL) SetError(FATAL, "valloc : NCBlock", err);
  26. #else
  27. sz = figure.size(alcsz, copy);
  28. #endif
  29. if(copy < 0) sign = UNDECIDED; //does not initialize
  30. else if(!copy) sign = ZERO;
  31. return sz;
  32. }

snmvaloc.cpp : last modifiled at 2015/11/27 16:05:46(1,046 bytes)
created at 2016/04/11 11:36:47
The creation time of this html file is 2017/10/27 10:59:17 (Fri Oct 27 10:59:17 2017).